<template>
  <view class="wrap">

    <view class="page-container" id="home">
      <view class="header-section" >
        <view class="navbar">
        <span class="search-icon" @click="search">
           <svg-icon :width="28" :height="80" icon="搜索" />
        </span>
          <span class="app-name">艮山记账</span>
          <span class="calendar-icon" @click="showCalendar">
          <svg-icon :width="28" :height="80" icon="日历" />
        </span>
        </view>

        <ul class="navbar-menu">
          <li class="menu-item">
        <span class="menu-title">
          2024年
        </span>
            <view class="right-section">
              <span class="month"> 01 </span>
              <span> 月 </span>
              <div></div>
            </view>
          </li>
          <li>
            <span class="menu-title"> 收入 </span>
            <span class="price">
          <span>0</span>
          <span>.00 </span>
        </span>
          </li>
          <li>
            <span class="menu-title"> 支出 </span>
            <span class="price">
          <span>760</span>
          <span>.00 </span>
        </span>
          </li>
          <li @click="openEyes">

            <svg-icon :width="28" :height="28" icon="眼睛"/>
          </li>
        </ul>

        <view class="main-navigation">

          <view class="nav-links">
            <ul>
              <li @click="openBookkeeping">
            <span>
              <svg-icon icon="记账" :width="28" :height="28" />
             <span>记账</span>
            </span>
              </li>
              <li @click="openBill">
            <span>
              <svg-icon icon="账单" :width="28" :height="28"/>
             <span>账单</span>
            </span>
              </li>
              <li @click="openAssets">
            <span>
              <svg-icon icon="资产" :width="28" :height="28"/>
             <span> 资产 </span>
            </span>
              </li>
              <li @click="openMore">

            <span>
              <svg-icon :width="28" :height="28" icon="更多"/>
             <span> 更多 </span>
            </span>
              </li>
            </ul>
          </view>
        </view>

      </view>
      <view  class="bill-content">

        <view v-for="dayItem in list" class="day-item">
          <view class="item-header">
            <view class="date">
              {{ dayItem.date }} {{ dayItem.weekDay }}
            </view>
            <view class="cost">
              支出: {{ dayItem.cost }}
            </view>
          </view>
          <view class="body">
            <view v-for="item in dayItem.items" class="single-item">
              <view class="icon">
                <svg-icon :icon="item.type" class="svg-icon" :width="28" :height="28" fillColor="hotpink"
                          background="pink" :box-width="40" :box-height="40"/>
              </view>
              <view class="title">
                <view class="type">{{ item.type }}</view>
                <view class="label">#{{ item.label }}</view>
              </view>
              <view class="cost">
              <span>
                {{ item.value }}
              </span>
              </view>
            </view>


          </view>
        </view>

      </view>

      <!--记账的表单-->
      <bookkeeping ref="bookkeeping"/>
      <!--添加账户的列表页-->
      <add-account-choose-list />

      <!--添加现金的表单页-->
      <add-account-choose-form />
      <!--添加储蓄卡列表页-->
      <add-account-savings-card-list />
      <!-- 添加储蓄卡表单页     -->
      <add-account-savings-card-form />
      <!-- 添加信用卡列表页     -->
      <add-account-credit-card-list />
      <!-- 添加信用卡表单页     -->
      <add-account-credit-card-form />

      <!-- 添加虚拟账户列表页     -->
      <add-account-virtual-card-list />
      <!-- 添加虚拟账户表单页     -->
      <add-account-virtual-card-form />

      <add-account-investment-account-list />



    </view>
  </view>

</template>

<script>
import SvgIcon from "@/pages/svg-icon.vue";
import bookkeeping from "@/pages/bookkeeping/index.vue";
import AddAccountChooseList from "@/pages/bookkeeping/add-account-choose-list.vue";
import AddAccountChooseForm from "@/pages/bookkeeping/add-account-choose-form.vue";
import AddAccountSavingsCardList from "@/pages/bookkeeping/add-account-savings-card-list.vue";
import AddAccountSavingsCardForm from "@/pages/bookkeeping/add-account-savings-card-form.vue";
import AddAccountCreditCardList from "@/pages/bookkeeping/add-account-credit-card-list.vue";
import AddAccountCreditCardForm from "@/pages/bookkeeping/add-account-credit-card-form.vue";
import AddAccountVirtualCardList from "@/pages/bookkeeping/add-account-virtual-card-list.vue";
import AddAccountVirtualCardForm from "@/pages/bookkeeping/add-account-virtual-card-form.vue";
import AddAccountInvestmentAccountList from "@/pages/bookkeeping/add-account-investment-account-list.vue";
import AddAccountInvestmentAccountForm from "@/pages/bookkeeping/add-account-investment-account-form.vue";

export default {
  components: {
    AddAccountInvestmentAccountList,
    AddAccountInvestmentAccountForm,
    AddAccountVirtualCardForm,
    AddAccountVirtualCardList,
    AddAccountCreditCardForm,
    AddAccountCreditCardList,
    AddAccountSavingsCardForm,
    AddAccountSavingsCardList, AddAccountChooseForm, AddAccountChooseList, SvgIcon,bookkeeping},
  mounted() {
  },
  data() {
    return {
      title: '艮山记账',
      insertDialog:false,
      list: [
        {
          cost: 6.96,
          date: '01月09日',
          weekDay: '星期二',
          items: [{
            type: '餐饮',
            label: '早餐',
            value: -5,
          }, {
            type: '交通',
            label: '公交地铁',
            value: -1.8,
          }]

        }, {
          cost: 10.96,
          date: '01月08日',
          weekDay: '星期一',
          items: [{
            type: '餐饮',
            label: '早餐',
            value: -5,

          }, {

            type: '交通',
            label: '公交地铁',
            value: -1.8,
          }]

        }, {
          cost: 10.96,
          date: '01月07日',
          weekDay: '星期三',
          items: [{
            type: '餐饮',
            label: '早餐',
            value: -5,

          }, {

            type: '交通',
            label: '公交地铁',
            value: -1.8,
          }]

        }, {
          cost: 10.96,
          date: '01月06日',
          weekDay: '星期三',
          items: [{
            type: '餐饮',
            label: '早餐',
            value: -5,

          }, {

            type: '交通',
            label: '公交地铁',
            value: -1.8,
          }]

        }, {
          cost: 10.96,
          date: '01月05日',
          weekDay: '星期三',
          items: [{
            type: '餐饮',
            label: '早餐',
            value: -5,

          }, {

            type: '交通',
            label: '公交地铁',
            value: -1.8,
          }]

        }, {
          cost: 10.96,
          date: '01月04日',
          weekDay: '星期三',
          items: [{
            type: '餐饮',
            label: '早餐',
            value: -5,

          }, {

            type: '交通',
            label: '公交地铁',
            value: -1.8,
          }]

        }

      ],
    };
  },
  methods: {
    openBookkeeping(){
      this.$refs.bookkeeping.enterPage()
    },
    openBill(){
      this.$modal.showToast('账单模块建设中~')
    },
    openAssets(){
      this.$modal.showToast('资产模块建设中~')
    },
    openMore(){
      this.$modal.showToast('更多模块建设中~')
    },
    search() {
      // 实现搜索功能
      this.$modal.showToast('搜索模块建设中~')
    },
    showCalendar() {
      this.$modal.showToast('日历模块建设中~')
    },
    openEyes(){
      this.$modal.showToast('眼睛模块建设中~')
    },
  }
};
</script>

<style scoped>
ul {
  margin: 0;
  padding: 0;
}
.wrap{
  position: absolute;
  top: 0;
  left: 0 ;
  right: 0;
  bottom: 0;
  background: green;
  overflow-y: scroll;
}
.page-container{
  display: flex;
  flex-direction: column;
  height: 100%;
}
.header-section{

}


.navbar {
  flex-direction: row;
  background: pink;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 80px;
}

.navbar svg {
  width: 28px;
}

.navbar span {
  font-size: 1rem;

}

.navbar span:nth-child(1) {

  text-align: left;
  margin-left: 20px;
}

.navbar span:nth-child(2) {
  text-align: center;
  flex-grow: 1;
  font-size: 1.3rem;
}


.navbar span:nth-child(3) {
  text-align: right;
  margin-right: 20px;
}

.navbar-menu {
  background: pink;
  display: flex;
  justify-content: space-between;
  padding: 0 20px 20px 20px;

}

.navbar-menu svg {

  width: 28px;
  height: 28px;
}

.menu-title {
  font-size: 0.7rem;
}

.month {
  font-size: 1.5rem;

}

.navbar-menu li {
  list-style: none;

  display: flex;
  flex-direction: column;
  justify-content: space-around;

}

.price {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
}

.price span:nth-child(1) {
  font-size: 1.3rem;
}

.price span:nth-child(2) {
  font-size: 1rem;
}

.nav-links {
  display: flex;
  flex-direction: column;

  margin-left: 20px;
  margin-right: 20px;
  border-radius: 8px;

  background: white;
  //box-shadow: #ccc 1px ;
  overflow: hidden;
  //margin-top: -88px;
  box-shadow: 3px 2px 3px #ccc;

}

.nav-links ul {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  align-items: center;
  height: 88px;

}

.nav-links ul li svg {
  flex: 1;

  width: 28px;
  height: 28px;
}

.nav-links ul li {
  display: flex;
  flex-direction: column;
  justify-content: space-around;

}

.main-navigation {

  height: 108px;
  background: -webkit-linear-gradient(top, pink, white);
  padding-bottom: 10px;

}

.nav-links ul li {
  list-style: none;
  text-align: center;
  height: 44px;
  //line-height: 44px;
  font-size: 1rem;

}

.nav-links ul li span {
  display: flex;
  flex-direction: column;

  justify-content: center;
}

.menu-item {
  display: flex;

}

.day-item {
  display: flex;
  flex-direction: column;
  border-bottom: 1px #eee solid;

}

.day-item .item-header {
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  background: white;
  padding-top: 10px;

}

.day-item .item-header .date {
  flex-grow: 1;
  margin-left: 20px;


}

.day-item .item-header .cost {

  margin-right: 20px;
  font-size: 1rem;
}

.day-item .body {
  display: flex;
  flex-direction: column;
  background: white;


}

.day-item .body .single-item {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 10px 0 10px 0;
  align-content: flex-end;

}

.day-item .body .single-item:last-child .title {
  border-bottom: none;

}

.single-item .icon .svg-icon {
  width: 28px;
  height: 28px;
  margin-left: 20px;

}

.single-item .title {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  margin-left: 10px;
  border-bottom: 1px #eee solid;

}


.single-item .type {
  font-size: 1.0rem;

}

.single-item .label {
  font-size: 0.6rem;
  margin-top: 2px;
  color: #bbb;

}
.bill-content{
  background: white;
  overflow-y: scroll;
  height: calc(100% - 251px);
}

.single-item .cost {
  margin-right: 20px;
  font-size: 1rem;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;

}

</style>